package com.example.wm.SanWar.controller;

import com.example.wm.SanWar.entity.CommunicationEntity;
import com.example.wm.SanWar.service.CommunicationService;
import com.example.wm.common.Result;
import com.example.wm.common.ResultData;
import com.example.wm.utils.TsyUtils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/SanWarCommunicationController")
public class CommunicationController {
    @Resource
    private CommunicationService communicationService;
    @Resource
    private TsyUtils tsyUtils;
    @Transactional
    @PostMapping("/Insert")
    public Result Insert(@RequestBody CommunicationEntity communicationEntity) {
        communicationEntity.setCommtime(tsyUtils.getnowtime());
        communicationService.save(communicationEntity);
        return ResultData.success(communicationEntity.getId());
    }






}
